<!--
 * @Descripttion: 模块辅助线
 * @version: 
 * @Author: 周志国
 * @Date: 2022-03-16 09:41:07
 * @LastEditors: 周志国
 * @LastEditTime: 2022-03-16 19:05:17
 * @changeLog: 
 * @FilePath: /anov-next/src/assets/js/app/cmlpanel/components/part/auxiliary.vue
-->
<template>
  <cml-module-item :title="titleText" :titleMore="titleText">
    <a-switch size="small" :checked="auxiliary" @change="setDragOpt" />
    <template v-slot:detail @click="test">
      <auxiliary-opt></auxiliary-opt>
    </template>
  </cml-module-item>
</template>
<script>
import { Switch } from 'ant-design-vue'
import CmlModuleItem from '../cml-module-item'
import AuxiliaryOpt from './auxiliaryOpt'
import { mapState, mapMutations } from 'vuex'

export default {
  name: 'Auxiliary',
  components: {
    ASwitch: Switch,
    CmlModuleItem,
    AuxiliaryOpt
  },
  model: {},
  props: {},
  data() {
    return {}
  },
  computed: {
    ...mapState('part', ['auxiliary']),
    titleText() {
      return this.$t('cmlpanel.auxiliary')
    }
  },
  watch: {
    auxiliary: {
      handler: function (v) {
        if (v === true) {
          app.partServer.addInfo('模块辅助线开启')
        } else {
          app.partServer.addInfo('模块辅助线关闭')
        }
      },
      immediate: false
    }
  },
  created() {},
  mounted() {},
  beforeDestroy() {},
  methods: {
    setDragOpt(val) {
      app.partServer.setDragOpt({ key: 'auxiliary', val })
    },
    test() {
      console.log('test')
    }
  }
}
</script>
<style lang="scss" scoped></style>
